package mao.exaimnation.netease;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author Totoro
 * @date 2020/8/8
 * @explain:
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int n = scanner.nextInt();
            int m = scanner.nextInt();
            int[] arr = new int[m];
            for (int i = 0; i < m; i++) {
                arr[i] = scanner.nextInt();
            }

            Integer[] residue = new Integer[n+1];
            for (int i = 1; i <= n; i++) {
                residue[i] = i;
            }
            for (int i = 0; i < m; i++) {
                residue[arr[i]] = null;
            }
            Arrays.sort(residue,((o1, o2) -> {
                if (null == o1 && null ==o2){
                    return 0;
                }
                if (o1 == null){
                    return -1;
                }
                if (o2 == null){
                    return 1;
                }
                String s1s2 = String.valueOf(o1)+String.valueOf(o2);
                String s2s1 = String.valueOf(o2)+String.valueOf(o1);
                if (s1s2.compareTo(s2s1) < 0)  return -1;
                else if (s1s2.equals(s2s1)) return 0;
                return 1;
            }));

            int index1 = 0;
            int index2 = m+1;
            int count = 0;
            while (index1 < m && index2 <= n){
                String s1s2 = String.valueOf(arr[index1])+String.valueOf(residue[index2]);
                String s2s1 = String.valueOf(residue[index2])+String.valueOf(arr[index1]);
                if (s1s2.compareTo(s2s1) <= 0){
                    System.out.print(arr[index1++]);
                } else {
                    System.out.print(residue[index2++]);
                }
                count++;
                if (count < n){
                    System.out.print(" ");
                }
            }

            while (index1 < m){
                System.out.print(arr[index1++]);
                count++;
                if (count < n){
                    System.out.print(" ");
                }
            }
            while (index2 <= n){
                System.out.print(residue[index2++]);
                count++;
                if (count < n){
                    System.out.print(" ");
                }
            }
            System.out.println();

        }
    }
}
